<?php

use think\migration\Migrator;
use think\migration\db\Column;

class AdminMenu extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
// create the table
        $table  =  $this->table('admin_menu');
        $table->addColumn('path', 'string',array('limit'  =>  255,'default'=>'','comment'=>'前端路由'))
            ->addColumn('pid', 'integer',array('limit'  =>  11,'default'=>0,'comment'=>'上级IDs'))
            ->addColumn('name', 'string',array('limit'  =>  50,'default'=>'','comment'=>'code'))
            ->addColumn('component', 'string',array('limit'  =>  255,'default'=>'','comment'=>'组件地址'))
            ->addColumn('icon', 'string',array('limit'  =>  50,'default'=>'','comment'=>'图标code'))
            ->addColumn('title', 'string',array('limit'  =>  50,'default'=>'','comment'=>'菜单名称'))
            ->addColumn('isLink', 'string',array('limit'=>255,'default'=>'' , 'comment'=>'跳转外部链接地址'))
            ->addColumn('isHide', 'boolean',array('limit'  =>  1,'default'=>0,'comment'=>'是否隐藏  1是 0否'))
            ->addColumn('isFull', 'boolean',array('limit'  =>  1,'default'=>0,'comment'=>'是否全屏  1是 0否'))
            ->addColumn('isAffix', 'boolean',array('limit'  =>  1,'default'=>0,'comment'=>'是否可关闭  1是 0否'))
            ->addColumn('isKeepAlive', 'boolean',array('limit'  =>  1,'default'=>1,'comment'=>'不知道是干啥的  1是 0否'))
            ->addColumn('create_time', 'datetime',array('default'=>null,'comment'=>'创建时间'))
            ->addColumn('update_time', 'datetime',array('default'=>null,'comment'=>'更新时间'))
            ->addColumn('delete_time', 'datetime',array('default'=>null,'comment'=>'删除时间'))
            ->create();
    }
}
